﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RouteTiming.Data;

namespace RouteTiming.DynamicModel
{
    public class DynamicRoutePoint : DynamicBaseEntity
    {
        private readonly RoutePoint _routePoint;

        public Guid Id
        {
            get { return this._routePoint.Id; }
        }

        public string Name
        {
            get { return this._routePoint.Name; }
        }

        public DateTime ScheduledPassTime { get; private set; }

        private DateTime _passTime;
        public DateTime PassTime
        {
            get { return _passTime; }
            internal set
            {
                this._passTime = value;

                this.FirePropertyChanged(() => this.PassTime);
                this.FirePropertyChanged(() => this.IsPassed);
                this.FirePropertyChanged(() => this.IsLate);
            }
        }

        public bool IsPassed
        {
            get { return this._passTime != DateTime.MinValue; }
        }

        public bool IsLate
        {
            get { return this._passTime > this.ScheduledPassTime; }
        }


        public DynamicRoutePoint(RoutePoint routePoint, DateTime scheduledPassTime)
        {
            this._routePoint = routePoint;
            this.ScheduledPassTime = scheduledPassTime;
        }


    }
}
